package com.fy.fyspace.mq.consumer;

import cn.hutool.core.date.DateTime;
import com.fy.fyspace.model.entity.TestUser;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class CustomerTest {
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "qq",durable = "true"),
            exchange = @Exchange( value = "exch", type = ExchangeTypes.DIRECT),
            key = ("k")))
    public void test(TestUser testUser){
        System.out.println("收到消息:"+testUser+new DateTime());
    }

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "qq"),
            exchange = @Exchange( value = "exch", type = ExchangeTypes.DIRECT),
            key = ("k")))
    public void test2(TestUser testUser){
        System.out.println("收到消息:"+testUser+new DateTime());
    }


}
